#!/usr/bin/python
import socket
import time
import datetime


# s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# s.connect(('52.83.198.136', 3001))
# while 1:
#    s.send(b'232302fe6666666666666666666666666666666666010157120c060b121c0101030100000000fe380f3227171201001ae3000002010104334e204e26370f1127140500073d6a2e01df3b2a06010b0e20013e0dfb010133010133070100000010010000110d0000000801010f322718006c00016c0e1f0e1f0e1f0e1f0e1f0e1f0000000000000e1f0e200e1f0e1c0e1c0e1b0e1a0e1c0e1b0e1c0e1c0e1c0e1c0e1c0e1b0e1f0e1e0e1f0e1c0e1f0e1a0e1d0e1f0e1e0e1f0e1e0e1c0e1a0e1b0e190e1b0e1c0e1b0e1b0e1c0e190e1b0e1b0e190e1d0e1e0e1f0e1e0e1f0e1d0e1c0e1d0e1e0e1c0e1e0e1e0dfe0dfb0dfe0dfe0dfc0dfe0dfe0dfe0dfe0dfe0dfe0dfc0e0b0e0c0e0b0e0c0e0d0e0c0e0d0e0c0e0c0e0c0e0a0e0c0e0c0e0b0e0a0e0b0e0a0e0b0e0a0e0b0e0a0e0b0e090e0a0e0f0e100e100e100e100e0f0e100e0d0e0f0e0d0e0f0e10090101001833333333333333333333333333333333333333333333333380040034567824')
#    d = s.recv(1024)
#    time.sleep(3)


def par(ss):
    buf = ''
    i = 0
    while True:
        if i >= len(ss):
            break
        t = ss[i] + ss[i + 1]
        i += 2
        n = int(t, 16)
        n = chr(n)
        buf += n
    return buf


if __name__ == "__main__":
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect(('127.0.0.1', 6688))

    ss = '232302fe6666666666666666666666666666666666010157120c060b121c0101030100000000fe380f3227171201001ae3000002010104334e204e26370f1127140500073d6a2e01df3b2a06010b0e20013e0dfb010133010133070100000010010000110d0000000801010f322718006c00016c0e1f0e1f0e1f0e1f0e1f0e1f0000000000000e1f0e200e1f0e1c0e1c0e1b0e1a0e1c0e1b0e1c0e1c0e1c0e1c0e1c0e1b0e1f0e1e0e1f0e1c0e1f0e1a0e1d0e1f0e1e0e1f0e1e0e1c0e1a0e1b0e190e1b0e1c0e1b0e1b0e1c0e190e1b0e1b0e190e1d0e1e0e1f0e1e0e1f0e1d0e1c0e1d0e1e0e1c0e1e0e1e0dfe0dfb0dfe0dfe0dfc0dfe0dfe0dfe0dfe0dfe0dfe0dfc0e0b0e0c0e0b0e0c0e0d0e0c0e0d0e0c0e0c0e0c0e0a0e0c0e0c0e0b0e0a0e0b0e0a0e0b0e0a0e0b0e0a0e0b0e090e0a0e0f0e100e100e100e100e0f0e100e0d0e0f0e0d0e0f0e10090101001833333333333333333333333333333333333333333333333380040034567824'
    ss = '232303FE4C44504141414B433448433130363439390301707BE5DC4E786FD5261B7C79883AF02950AC4B10D458E2F394725BF62FC4F092CB62990F4CC5ED1F9B44FB35EA6989F82EB05D8EC1DAD574BAE994509D4B7E02068A20115E8B02FD486AFEC9C8C211F4AAF5AC2030C1A33C7F0B4398AE3F61FDB7F414D68FBEEBBD76E6800ED380ADB724DD2FECD383C233B2D654A2957FFD76D55C90502608EAADBC2451DFAE211CED7BFEF7A65E10628B274A38546712B94C09FEF7A65E10628B274A38546712B94C09FEF7A65E10628B274A38546712B94C09FEF7A65E10628B274A38546712B94C09FEF7A65E10628B274A38546712B94C09FEF7A65E10628B274A38546712B94C09FEF7A65E10628B274A38546712B94C09FEF7A65E10628B274A38546712B94C09FEF7A65E10628B274A38546712B94C09FEF7A65E10628B274A38546712B94C09FEF7A65E10628B274A38546712B94C0933894398A5FF7C32060E0003B01146929685CD37A8BCEECC5ADAA0DEFED4BC72D16249D2EAD70717A6DA258A5ED7AAB43D'
    # buf = par(ss)
    # buf = str(buf)
    while 1:
        # a = s.send(buf)
        a = s.send(bytes(ss.encode("utf-8")))
        d = s.recv(1024)
        print(datetime.datetime.now())
        print(d[4:21])
        time.sleep(3)
